package com.dgut.oss.controller;

import com.dgut.commonutils.Result;
import com.dgut.oss.service.OssService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

@RestController
@RequestMapping("/doctorOss/fileoss")
@CrossOrigin
public class OssController {

    @Autowired
    private OssService ossService;

    @ApiOperation("上传头像")
    @PostMapping("uploadFile")
    public Result uploadOssFile(MultipartFile file){

        String url=ossService.uploadFileAvatar(file);
        return Result.succ().data("url",url);
    }
}
